# -*- coding: utf-8 -*-

from django.db import models

# Create your models here.

class Hipermercado (models.Model):
    ''' codigo_hipermercado = models.ForeignKey(User, unique=True) '''
    nom_hiper = models.CharField(max_length=200, blank=True)
    localidad = models.CharField(max_length=200, blank=True)
    provincia = models.CharField(max_length=200, blank=True)
    direccion = models.CharField(max_length=200, blank=True)
    '''telefono = IntegerField()
    cp = IntegerField()'''
    ''' fecha = models.DateTimeField(u'fecha publicacion') '''
    nom_dir_compras = models.CharField(max_length=200, blank=True)
    
    def __unicode__(self):
        return self.nom_hiper
    
class Proveedor(models.Model):
    
    nombre_prov = models.CharField(max_length=200, blank=True)
    localidad = models.CharField(max_length=200, blank=True)
    provincia = models.CharField(max_length=200, blank=True)
    direccion = models.CharField(max_length=200, blank=True)
    '''telefono = IntegerField()
    cp = IntegerField()'''
    
    def __unicode__(self):
        return self.el
        
class Producto(models.Model):
    cif_prov = models.ForeignKey(Proveedor)
    nom_hiper = models.CharField(max_length=200, blank=True)
    localidad = models.CharField(max_length=200, blank=True)
    provincia = models.CharField(max_length=200, blank=True)
    direccion = models.CharField(max_length=200, blank=True)
    '''telefono = IntegerField()
    cp = IntegerField()'''

    def __unicode__(self):
        return self.id
    
class Vender(models.Model):
    cod_prod_int = models.ForeignKey(Producto)
    cod_hiper = models.ForeignKey(Hipermercado)
    '''unid_vendidas = IntegerField()'''
